package com.ysynzehao.dubbo.web.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ysynzehao.dubbo.order.model.Order;
import com.ysynzehao.dubbo.service.order.OrderService;
import com.ysynzehao.dubbo.service.user.UserService;
import com.ysynzehao.dubbo.user.model.User;

@Controller
@RequestMapping("/user")  
public class UserController {
	
	@Reference
	private UserService userService;
	
	@Reference
	private OrderService orderService;
	
	@ResponseBody
	@RequestMapping(value="/getUserOrder", method = RequestMethod.GET)
	public Map<String, Object> getUserOrder() {
		User user = userService.getUser(1l);
		Order order = orderService.getOrder(1l);
		Map<String, Object> map = new HashMap<>();
		map.put("user", user);
		map.put("order", order);
		return map;
	}

}
